dac24 2.2.0
Loading...
Searching...
No Matches
DAC 24 Click Driver

API for configuring and manipulating DAC 24 Click driver. More...

Topics

 DAC 24 Registers List
 List of registers of DAC 24 Click driver.
 DAC 24 Registers Settings
 Settings for registers of DAC 24 Click driver.
 DAC 24 MikroBUS Map
 MikroBUS pin mapping of DAC 24 Click driver.

Functions

void dac24_cfg_setup (dac24_cfg_t *cfg)
 DAC 24 configuration object setup function.
err_t dac24_init (dac24_t *ctx, dac24_cfg_t *cfg)
 DAC 24 initialization function.
err_t dac24_write_reg (dac24_t *ctx, uint8_t reg, uint8_t data_in)
 DAC 24 write register function.
err_t dac24_set_power_down (dac24_t *ctx, uint8_t pwr)
 DAC 24 set power down function.
err_t dac24_set_dac_value (dac24_t *ctx, uint8_t channel, uint8_t value)
 DAC 24 set DAC value function.
err_t dac24_set_dac_voltage (dac24_t *ctx, uint8_t channel, uint16_t voltage_mv)
 DAC 24 set DAC voltage function.

Detailed Description

API for configuring and manipulating DAC 24 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ dac24_cfg_setup()

void dac24_cfg_setup ( dac24_cfg_t * cfg)

DAC 24 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See dac24_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ dac24_init()

err_t dac24_init ( dac24_t * ctx,
dac24_cfg_t * cfg )

DAC 24 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See dac24_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See dac24_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dac24_set_dac_value()

err_t dac24_set_dac_value ( dac24_t * ctx,
uint8_t channel,
uint8_t value )

DAC 24 set DAC value function.

This function writes the 8-bit DAC code value to one or more channels.

Parameters
[in]ctx: Click context object. See dac24_t object definition for detailed explanation.
[in]channel: DAC channels to be updated, see DAC24_CHANNEL_x macros.
[in]value: DAC code value (0 to DAC24_DAC_VALUE_MAX).
Returns
  • 0 - Success,
  • -1 - Error (invalid channel argument). See #err_t definition for detailed explanation.
Note
None.

◆ dac24_set_dac_voltage()

err_t dac24_set_dac_voltage ( dac24_t * ctx,
uint8_t channel,
uint16_t voltage_mv )

DAC 24 set DAC voltage function.

This function sets the output voltage (in millivolts) for one or more channels by converting it to a corresponding DAC code and updating the device.

Parameters
[in]ctx: Click context object. See dac24_t object definition for detailed explanation.
[in]channel: DAC channels to be updated, see DAC24_CHANNEL_x macros.
[in]voltage_mv: Desired output voltage in millivolts.
Returns
  • 0 - Success,
  • -1 - Error (voltage out of range). See #err_t definition for detailed explanation.
Note
The calculation is based on the DAC24_VCC_LEVEL setting.

◆ dac24_set_power_down()

err_t dac24_set_power_down ( dac24_t * ctx,
uint8_t pwr )

DAC 24 set power down function.

This function sets the device in the selected power down mode.

Parameters
[in]ctx: Click context object. See dac24_t object definition for detailed explanation.
[in]pwr: Power down setting, see DAC24_POWER_DOWN_x macros.
Returns
  • 0 - Success,
  • -1 - Error (invalid pwr argument). See #err_t definition for detailed explanation.
Note
None.

◆ dac24_write_reg()

err_t dac24_write_reg ( dac24_t * ctx,
uint8_t reg,
uint8_t data_in )

DAC 24 write register function.

This function writes a data byte to the selected register address.

Parameters
[in]ctx: Click context object. See dac24_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: 8-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.